package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.Company;
import com.junsi.mapper.CompanyMapper;
import com.junsi.service.CompanySerivce;

/**
 * 公司Serivce接口实现类
 * @author wkp
 *
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CompanySerivceImpl implements CompanySerivce {

	@Autowired
	private CompanyMapper companyMapper;
	
	@Override
	public Company findById(Integer id) {
		
		return companyMapper.findById(id);
	}

	@Override
	public List<Company> findByAll() {
		
		return companyMapper.findByAll();
	}

	@Override
	public boolean save(Company company) {
		int i = companyMapper.save(company);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	public boolean update(Company company) {
		int i = companyMapper.update(company);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	public boolean delete(Integer id) {
		int i = companyMapper.delete(id);
		if(i == 1){
			return true;
		}
		return false;
	}

}
